cc.Class({
    extends: cc.Component,

    properties: {
        scoreText: cc.Label,
        pencilsLayer: cc.Node
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        D.game = this;
        this.run = true;
        this.score = 0;
        this.scoreText.string = this.score;
        cc.director.getCollisionManager().enabled = true;
        cc.director.getCollisionManager().enabledDebugDraw = true;
    },

    start () {
        D.pencilsManger.spawnPencils();
    },

    addScore() {
        this.score++;
        this.scoreText.string = this.score;
    },

    gameOver() {
        this.run = false;
    }
});
